home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / windows1 / al12xw.zip / AUTOFON.XWS < prev    next >
Text File  |  1991-01-23  |  32KB  |  708 lines

  1. /*
  2. CrossTalk for Windows AutoList/Date Script
  3. (C) Ashley Saldanha
  4. 1/05/1991
  5. */
  6.  
  7. -- Initial off-line check.
  8.  
  9. LABEL CHECKON
  10.         activate
  11.         if not online or not connected then goto setup
  12.         message "AutoList error..."
  13.         topic="Error":mess="CrossTalk is already online.":b1="&Hangup":b2="&Cancel":gosub common2
  14.                 if choice=2 then end
  15.                 if choice=1 then bye:goto checkon
  16.         bye:goto setup
  17.  
  18. -- Script variables and default directory name parsing.  If no directory filename
  19. -- is specified on the command line, "AUTOLIST.FON is loaded by default.  Error
  20. -- and dialog messages share common subroutines.
  21.  
  22. LABEL SETUP
  23.         integer icon,dirfile,nil,look,x,list
  24.         integer n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,n18,n19
  25.         string d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,d18,d19
  26.         string p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19
  27.         string t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18
  28.         string y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16,y17,y18
  29.         string z1,z2,z3,z4,z5,z6,z7,z8,z9,z10,z11,z12,z13,z14,z15,z16,z17,z18
  30.         string dirname,defxwp,defdesc,dump,current,topic,mess,b1,b2
  31.         string num,xwpdir,ddesc,scrap,w,y,z,listdir
  32.         nil=true
  33.         look=true
  34.         eoln=chr(13)+chr(10)
  35.         curshape=0
  36.         y=" - "
  37.         w=date
  38.         dirname=arg(1)
  39.         if null(dirname) then dirname="autolist.fon"
  40.         current=upcase(dirname)
  41.         xwpdir=dirxwp
  42.         dirname=dirxwp+"\"+dirname
  43.         if length(dirxwp)>13 then xwpdir=left(dirxwp,13)
  44.         if right(xwpdir)<>"\" then xwpdir=left(dirxwp,12)
  45.         if right(xwpdir)<>"\" then xwpdir=left(dirxwp,11)
  46.         if right(xwpdir)<>"\" then xwpdir=left(dirxwp,10)
  47.         if right(xwpdir)<>"\" then xwpdir=left(dirxwp,9)
  48.         if right(xwpdir)<>"\" then xwpdir=left(dirxwp,8)
  49.         if right(xwpdir)<>"\" then xwpdir=left(dirxwp,7)
  50.         if right(xwpdir)<>"\" then xwpdir=left(dirxwp,6)
  51.         xwpdir=upcase(xwpdir)+"..."
  52.         goto read_dir
  53.  
  54. -- Create and/or read directory list file and add hyphen to description.
  55.  
  56. LABEL READ_DIR
  57.         new
  58.         if not exists(dirname) then {
  59.                 message "Compiling directory list, please wait..."
  60.                 dirfile=freefile
  61.                 open output dirname as dirfile
  62.                 close dirfile
  63.                 scrap=filefind(dirxwp + "\*.xwp")
  64.                 while not null(scrap) 
  65.                         load scrap
  66.                         if not null(number) then {
  67.                                 defxwp=name:defdesc=description
  68.                                 open append dirname as dirfile
  69.                                 write dirfile,defxwp,defdesc,
  70.                                 }
  71.                         close dirfile
  72.                         scrap=filefind
  73.                 wend:new
  74.                 }
  75.         dirfile=freefile
  76.         if dirfile=0 then {
  77.                 message "Error..."
  78.                 topic="Error":mess="Try re-installing AutoList.":gosub common1:end
  79.                 }
  80.         message "Reading directory list, please wait..."
  81.         open input dirname as dirfile
  82.         while not eof(dirfile)
  83.                 read #dirfile,p1,d1,t1,p2,d2,t2,p3,d3,t3,p4,d4,t4,p5,d5,t5,p6,d6,t6,p7,d7,t7,p8,d8,t8,p9,d9,t9,p10,d10,t10,p11,d11,t11,p12,d12,t12,p13,d13,t13,p14,d14,t14,p15,d15,t15,p16,d16,t16,p17,d17,t17,p18,d18,t18
  84.                 if not eof then topic="Alert":mess="Maximum of 18 entries allowed per list.":gosub common1:goto page1
  85.         wend
  86.         close dirfile:cls
  87.         y1=t1:y2=t2:y3=t3:y4=t4:y5=t5:y6=t6:y7=t7:y8=t8:y9=t9:y10=t10:y11=t11:y12=t12:y13=t13:y14=t14:y15=t15:y16=t16:y17=t17:y18=t18
  88.         if not null(p1) then z1=y+d1 else z1=d1
  89.         if not null(p2) then z2=y+d2 else z2=d2
  90.         if not null(p3) then z3=y+d3 else z3=d3
  91.         if not null(p4) then z4=y+d4 else z4=d4
  92.         if not null(p5) then z5=y+d5 else z5=d5
  93.         if not null(p6) then z6=y+d6 else z6=d6
  94.         if not null(p7) then z7=y+d7 else z7=d7
  95.         if not null(p8) then z8=y+d8 else z8=d8
  96.         if not null(p9) then z9=y+d9 else z9=d9
  97.         if not null(p10) then z10=y+d10 else z10=d10
  98.         if not null(p11) then z11=y+d11 else z11=d11
  99.         if not null(p12) then z12=y+d12 else z12=d12
  100.         if not null(p13) then z13=y+d13 else z13=d13
  101.         if not null(p14) then z14=y+d14 else z14=d14
  102.         if not null(p15) then z15=y+d15 else z15=d15
  103.         if not null(p16) then z16=y+d16 else z16=d16
  104.         if not null(p17) then z17=y+d17 else z17=d17
  105.         if not null(p18) then z18=y+d18 else z18=d18
  106.         goto page1
  107.  
  108. -- First page dialog.  Dialogs were designed with Excel's Dialog Editor
  109. -- and depart as little as possible from CrossTalk's native dialog boxes.
  110.  
  111. LABEL PAGE1
  112.         message "AutoList Phone Book (pg.1)"
  113.         dialogbox 25,16,270,132
  114.                 ltext 8,2,208,8,"Phone Book Entries in "+xwpdir+"\"+current
  115.                 groupbox 8,10,208,118,""
  116.                 checkbox 12,16,170,12,upcase(p1)+z1,n1,tabstop focus
  117.                 checkbox 12,28,170,12,upcase(p2)+z2,n2,tabstop
  118.                 checkbox 12,40,170,12,upcase(p3)+z3,n3,tabstop
  119.                 checkbox 12,52,170,12,upcase(p4)+z4,n4,tabstop
  120.                 checkbox 12,64,170,12,upcase(p5)+z5,n5,tabstop
  121.                 checkbox 12,76,170,12,upcase(p6)+z6,n6,tabstop
  122.                 checkbox 12,88,170,12,upcase(p7)+z7,n7,tabstop
  123.                 checkbox 12,100,170,12,upcase(p8)+z8,n8,tabstop
  124.                 checkbox 12,112,170,12,upcase(p9)+z9,n9,tabstop
  125.                 rtext 183,18,31,12,y1
  126.                 rtext 183,30,31,12,y2
  127.                 rtext 183,42,31,12,y3
  128.                 rtext 183,54,31,12,y4
  129.                 rtext 183,66,31,12,y5
  130.                 rtext 183,78,31,12,y6
  131.                 rtext 183,90,31,12,y7
  132.                 rtext 183,102,31,12,y8
  133.                 rtext 183,114,31,12,y9
  134.                 defpushbutton 225,14,36,17,"&Dial",ok,tabstop group
  135.                 pushbutton 225,34,36,17,"PgD&n",tabstop
  136.                 pushbutton 225,54,17,14,"&+",tabstop
  137.                 pushbutton 244,54,17,14,"&-",tabstop
  138.                 pushbutton 225,71,36,17,"&Manual",tabstop
  139.                 pushbutton 225,91,36,17,"&Options",tabstop
  140.                 pushbutton 225,111,36,17,"&Close",cancel,tabstop
  141.         enddialog
  142.         if choice=7 then goto finish    
  143.         if choice=6 then goto options
  144.         if choice=5 then goto manual
  145.         if choice=4 then goto untag
  146.         if choice=3 then goto tag1
  147.         if choice=2 then goto page2
  148.         if choice=1 then goto checklist
  149.         goto page1
  150.  
  151. -- Second page dialog.  Additional "pages" are easily added, but increase
  152. -- the number of variables that must be stored, with predictable consequences
  153. -- on the execution speed of the script.
  154.  
  155. LABEL PAGE2
  156.         message "AutoList Phone Book (pg.2)"
  157.         dialogbox 25,16,270,132
  158.                 ltext 8,2,208,8,"Phone Book Entries in "+xwpdir+"\"+current
  159.                 ctext 225,2,36,8,"(Page 2)"
  160.                 groupbox 8,10,208,118,""
  161.                 checkbox 12,16,170,12,upcase(p10)+z10,n10,tabstop
  162.                 checkbox 12,28,170,12,upcase(p11)+z11,n11,tabstop
  163.                 checkbox 12,40,170,12,upcase(p12)+z12,n12,tabstop
  164.                 checkbox 12,52,170,12,upcase(p13)+z13,n13,tabstop
  165.                 checkbox 12,64,170,12,upcase(p14)+z14,n14,tabstop
  166.                 checkbox 12,76,170,12,upcase(p15)+z15,n15,tabstop
  167.                 checkbox 12,88,170,12,upcase(p16)+z16,n16,tabstop
  168.                 checkbox 12,100,170,12,upcase(p17)+z17,n17,tabstop
  169.                 checkbox 12,112,170,12,upcase(p18)+z18,n18,tabstop
  170.                 rtext 183,18,31,12,y10
  171.                 rtext 183,30,31,12,y11
  172.                 rtext 183,42,31,12,y12
  173.                 rtext 183,54,31,12,y13
  174.                 rtext 183,66,31,12,y14
  175.                 rtext 183,78,31,12,y15
  176.                 rtext 183,90,31,12,y16
  177.                 rtext 183,102,31,12,y17
  178.                 rtext 183,114,31,12,y18
  179.                 defpushbutton 225,14,36,17,"&Dial",ok,tabstop group
  180.                 pushbutton 225,34,36,17,"Pg&Up",tabstop
  181.                 pushbutton 225,54,17,14,"&+",tabstop
  182.                 pushbutton 244,54,17,14,"&-",tabstop
  183.                 pushbutton 225,71,36,17,"&Manual",tabstop
  184.                 pushbutton 225,91,36,17,"&Options",tabstop
  185.                 pushbutton 225,111,36,17,"&Close",cancel,tabstop
  186.         enddialog
  187.         if choice=7 then goto finish    
  188.         if choice=6 then goto options
  189.         if choice=5 then goto manual
  190.         if choice=4 then goto untag
  191.         if choice=3 then goto tag2
  192.         if choice=2 then goto page1
  193.         if choice=1 then goto checklist
  194.  
  195. -- The options dialog.  There is a limit on the number of characters that
  196. -- the list box can display at one time, and the final entry is blank.
  197.  
  198. LABEL OPTIONS
  199.         listdir=""
  200.         scrap=filefind(dirxwp+"\*.fon")
  201.         repeat
  202.                 listdir=listdir+scrap+","
  203.                 scrap=filefind
  204.         until null(scrap) or (length(listdir)>240) 
  205.         scrap=filefind(dirxwp+"\*.xwp")
  206.         repeat
  207.                 listdir=listdir+scrap+","
  208.                 scrap=filefind
  209.         until null(scrap) or (length(listdir)>240) 
  210.         message "AutoList Options"
  211.         dialogbox 25,16,270,132
  212.                 groupbox 6,4,150,122,""
  213.                 ctext 14,4,135,8,"CrossTalk for Windows AutoList"
  214.                 ctext 8,20,145,8,"Release 1.2D"
  215.                 ctext 8,29,145,8,"Copyright ⌐ 1991, Ashley Saldanha"
  216.                 ctext 8,45,145,8,"AutoList is freeware.  It may"
  217.                 ctext 8,53,145,8,"be freely used and distributed."
  218.                 ctext 8,61,145,8,"Please direct comments and"
  219.                 ctext 8,69,145,8,"donations to:"
  220.                 ctext 8,85,145,8,"EnTech"
  221.                 ctext 8,93,145,8,"RFD 1, Box 555"
  222.                 ctext 8,101,145,8,"Orr's Island, Maine  04066"
  223.                 ctext 8,112,145,8,"CIS 72677,2370"
  224.                 listbox 160,9,62,65,listdir,list,tabstop
  225.                 groupbox 160,75,62,51,"Options"
  226.                 radiobutton 163,86,40,12,"N&ormal",nil,tabstop group
  227.                 radiobutton 163,99,42,12,"Mi&nimize",icon,tabstop 
  228.                 checkbox 163,112,40,12,"&Watch",look,tabstop
  229.                 defpushbutton 228,8,36,17,"&Open",tabstop group
  230.                 pushbutton 228,28,36,17,"&Cancel",cancel,tabstop focus
  231.                 pushbutton 228,48,36,17,"C&ompile",tabstop
  232.                 pushbutton 228,68,36,17,"&Edit",tabstop
  233.                 pushbutton 228,88,36,17,"&New",tabstop group
  234.                 pushbutton 228,108,36,17,"&Delete",tabstop
  235.         enddialog
  236.         if choice=1 then {
  237.                 dump=slice(listdir,list,",")
  238.                 if length(dump)=0 then goto options
  239.                 if right(dump,4)=".XWP" then scrap=dump:goto single
  240.                 dirname=dump
  241.                 current=upcase(dirname)
  242.                 dirname=dirxwp+"\"+dirname:goto read_dir
  243.                 }
  244.         if choice=2 then goto page1
  245.         if choice=3 then goto recompile
  246.         if choice=4 then goto edit1
  247.         if choice=5 then goto newdir
  248.         if choice=6 then {
  249.                 dump=slice(listdir,list,",")
  250.                 if length(dump)=0 then goto options
  251.                 message "Press [ESC] to cancel."
  252.                 topic="Confirm":mess="Delete  "+dump+"  ?":b1="&Ok":b2="&Cancel":gosub common2
  253.                 if choice=2 then goto options
  254.                 dump=dirxwp+"\"+dump
  255.                 if exists(dump) then delete dump:goto options
  256.                 }
  257.  
  258. -- Manual dial dialog.  Rather than dial the number immediately, the script
  259. -- assign a temporary variable (n19) to the number so that it may be inserted
  260. -- into a queue, and recalled at a later point in a session.
  261.  
  262. LABEL MANUAL
  263.         message "Press [ESC] to cancel."
  264.         dialogbox 45,60,232,19
  265.                 checkbox 3,3,28,12,"&Dial ",n19,tabstop
  266.                 edittext 31,3,64,12,z,d19,focus
  267.                 ltext 101,5,88,12,"with default settings"
  268.                 defpushbutton 194,3,36,14,"Ok",ok,tabstop
  269.         enddialog
  270.         if choice=1 then {
  271.                 if length(d19)=7 then d19=left(d19,3)+"-"+right(d19,4)
  272.                 if length(d19)=11 then d19=left(d19,1)+"-"+right(d19,10):d19=left(d19,5)+"-"+right(d19,7):d19=left(d19,9)+"-"+right(d19,4)
  273.                 z=d19
  274.                 p19=d19
  275.                 if n19=false then {
  276.                         if length(p19)=0 then goto page1
  277.                         new
  278.                         redialcount=99
  279.                         description=p19+" (manual entry)"
  280.                         trap on
  281.                         dial p19:if connected then alarm:show:display=on:end
  282.                         if error then topic="Alert":mess="No connection or call cancelled.":gosub common1:trap off:goto page1
  283.                         trap off:goto page1
  284.                         }       
  285.                 if length(p19)=0 then topic="Error":mess="No number entered.":gosub common1:goto manual
  286.                 goto page1
  287.                 }
  288.         else goto page1
  289.  
  290. -- New directory list prompt dialog, on a profile-by-profile basis.
  291.  
  292. LABEL INCLUDE
  293.         dirfile=freefile
  294.         open output dirname as dirfile
  295.         close dirfile
  296.         open input dirname as dirfile
  297.         scrap=filefind(dirxwp + "\*.xwp")
  298.         while not null(scrap) 
  299.                 message "Press [ESC] to edit manually."
  300.                 dialogbox 85,36,155,72
  301.                         groupbox 7,4,94,63,"Options"
  302.                         ltext 12,20,84,40,"Include  "+scrap+"  in new directory list?"
  303.                         defpushbutton 111,8,36,17,"&Yes",ok,tabstop,focus
  304.                         pushbutton 111,29,36,17,"&No",tabstop
  305.                         pushbutton 111,50,36,17,"&Cancel",cancel,tabstop
  306.                 enddialog
  307.                 if choice=3 then close dirfile:goto read_dir
  308.                 if choice=1 then {
  309.                         load scrap
  310.                         defxwp=name:defdesc=description
  311.                         open append dirname as dirfile
  312.                         write dirfile,defxwp,defdesc,
  313.                         }
  314.                 close dirfile:new
  315.                 scrap=filefind
  316.         wend
  317.         new
  318.         close dirfile:cls
  319.         new:return
  320.  
  321. -- First page of the edit dialog.  Variables are copied to avoid loss of
  322. -- changes when switching from page to page.
  323.  
  324. LABEL EDIT1
  325.         y10=p10:y11=p11:y12=p12:y13=p13:y14=p14:y15=p15:y16=p16:y17=p17:y18=p18
  326.         z10=d10:z11=d11:z12=d12:z13=d13:z14=d14:z15=d15:z16=d16:z17=d17:z18=d18
  327.         message "AutoList Editor (pg.1)"
  328.         dialogbox 36,16,250,132
  329.                 edittext 4,4,39,12,p1,y1,tabstop focus
  330.                 edittext 48,4,158,12,d1,z1,tabstop
  331.                 edittext 4,18,39,12,p2,y2,tabstop
  332.                 edittext 48,18,158,12,d2,z2,tabstop
  333.                 edittext 4,32,39,12,p3,y3,tabstop
  334.                 edittext 48,32,158,12,d3,z3,tabstop
  335.                 edittext 4,46,39,12,p4,y4,tabstop
  336.                 edittext 48,46,158,12,d4,z4,tabstop
  337.                 edittext 4,60,39,12,p5,y5,tabstop
  338.                 edittext 48,60,158,12,d5,z5,tabstop
  339.                 edittext 4,74,39,12,p6,y6,tabstop
  340.                 edittext 48,74,158,12,d6,z6,tabstop
  341.                 edittext 4,88,39,12,p7,y7,tabstop
  342.                 edittext 48,88,158,12,d7,z7,tabstop
  343.                 edittext 4,102,39,12,p8,y8,tabstop
  344.                 edittext 48,102,158,12,d8,z8,tabstop
  345.                 edittext 4,116,39,12,p9,y9,tabstop
  346.                 edittext 48,116,158,12,d9,z9,tabstop
  347.                 ctext 210,2,36,8,"(Page 1)"
  348.                 defpushbutton 210,29,36,17,"&Save",ok,tabstop group
  349.                 pushbutton 210,49,36,17,"Pg&Dn",tabstop
  350.                 pushbutton 210,69,36,17,"&Editor",tabstop
  351.                 pushbutton 210,89,36,17,"&Cancel",tabstop
  352.         enddialog
  353.         if choice=4 then goto read_dir
  354.         if choice=3 then goto edit3
  355.         if choice=2 then {
  356.                 p1=y1:p2=y2:p3=y3:p4=y4:p5=y5:p6=y6:p7=y7:p8=y8:p9=y9
  357.                 d1=z1:d2=z2:d3=z3:d4=z4:d5=z5:d6=z6:d7=z7:d8=z8:d9=z9
  358.                 goto edit2
  359.                 }
  360.         if choice=1 then gosub writelist
  361.         goto read_dir
  362.  
  363. -- Second page of the edit dialog.
  364.  
  365. LABEL EDIT2
  366.         message "AutoList Editor (pg.2)"
  367.         dialogbox 36,16,250,132
  368.                 edittext 4,4,39,12,p10,y10,tabstop focus
  369.                 edittext 48,4,158,12,d10,z10,tabstop
  370.                 edittext 4,18,39,12,p11,y11,tabstop
  371.                 edittext 48,18,158,12,d11,z11,tabstop
  372.                 edittext 4,32,39,12,p12,y12,tabstop
  373.                 edittext 48,32,158,12,d12,z12,tabstop
  374.                 edittext 4,46,39,12,p13,y13,tabstop
  375.                 edittext 48,46,158,12,d13,z13,tabstop
  376.                 edittext 4,60,39,12,p14,y14,tabstop
  377.                 edittext 48,60,158,12,d14,z14,tabstop
  378.                 edittext 4,74,39,12,p15,y15,tabstop
  379.                 edittext 48,74,158,12,d15,z15,tabstop
  380.                 edittext 4,88,39,12,p16,y16,tabstop
  381.                 edittext 48,88,158,12,d16,z16,tabstop
  382.                 edittext 4,102,39,12,p17,y17,tabstop
  383.                 edittext 48,102,158,12,d17,z17,tabstop
  384.                 edittext 4,116,39,12,p18,y18,tabstop
  385.                 edittext 48,116,158,12,d18,z18,tabstop
  386.                 ctext 210,2,36,8,"(Page 2)"
  387.                 defpushbutton 210,29,36,17,"&Save",ok,tabstop group
  388.                 pushbutton 210,49,36,17,"Pg&Up",tabstop
  389.                 pushbutton 210,69,36,17,"&Editor",tabstop
  390.                 pushbutton 210,89,36,17,"&Cancel",tabstop
  391.         enddialog
  392.         if choice=4 then goto read_dir
  393.         if choice=3 then goto edit3
  394.         if choice=2 then {
  395.                 p10=y10:p11=y11:p12=y12:p13=y13:p14=y14:p15=y15:p16=y16:p17=y17:p18=y18
  396.                 d10=z10:d11=z11:d12=z12:d13=z13:d14=z14:d15=z15:d16=z16:d17=z17:d18=z18
  397.                 goto edit1
  398.                 }
  399.         if choice=1 then gosub writelist
  400.         goto read_dir
  401.  
  402. -- Writes directory list changes.
  403.  
  404. LABEL WRITELIST
  405.         if exists(dirname) then delete dirname
  406.         if not exists(dirname) then {
  407.                 message "Updating directory list, please wait..."
  408.                 dirfile=freefile
  409.                 open output dirname as dirfile
  410.                 close dirfile
  411.                 open append dirname as dirfile
  412.                 write dirfile,y1,z1,t1
  413.                 write dirfile,y2,z2,t2
  414.                 write dirfile,y3,z3,t3
  415.                 write dirfile,y4,z4,t4
  416.                 write dirfile,y5,z5,t5
  417.                 write dirfile,y6,z6,t6
  418.                 write dirfile,y7,z7,t7
  419.                 write dirfile,y8,z8,t8
  420.                 write dirfile,y9,z9,t9
  421.                 write dirfile,y10,z10,t10
  422.                 write dirfile,y11,z11,t11
  423.                 write dirfile,y12,z12,t12
  424.                 write dirfile,y13,z13,t13
  425.                 write dirfile,y14,z14,t14
  426.                 write dirfile,y15,z15,t15
  427.                 write dirfile,y16,z16,t16
  428.                 write dirfile,y17,z17,t17
  429.                 write dirfile,y18,z18,t18
  430.                 close dirfile
  431.                 }
  432.         return
  433.  
  434. -- Loads editor specified in the CrossTalk "System" options; if none
  435. -- exists, then attempts to load the Windows Notepad.
  436.  
  437. LABEL EDIT3
  438.         message "Loading editor, please wait..."
  439.         if null(editor) then run "notepad.exe "+dirname
  440.         else run editor+" "+dirname:end
  441.  
  442. -- Rewrites the current directory by deleting the filename and then 
  443. -- chaining to the Include subroutine above. 
  444.  
  445. LABEL RECOMPILE
  446.         message "Press [ESC] to cancel."
  447.         topic="Confirm":mess="Erase current directory list and recompile?":b1="&Ok":b2="&Cancel":gosub common2
  448.         if choice=2 then goto options
  449.         if choice=1 then {
  450.                 if exists(dirname) then delete dirname
  451.                 gosub include:goto read_dir
  452.                 }
  453.  
  454. -- First page global tag.  Only "real" entries are tagged.
  455.  
  456. LABEL TAG1
  457.         if length(p1)>0 then n1=true:if length(p2)>0 then n2=true:if length(p3)>0 then n3=true
  458.         if length(p4)>0 then n4=true:if length(p5)>0 then n5=true:if length(p6)>0 then n6=true
  459.         if length(p7)>0 then n7=true:if length(p8)>0 then n8=true:if length(p9)>0 then n9=true
  460.         goto page1
  461.  
  462. -- Second page global tag.
  463.  
  464. LABEL TAG2
  465.         if length(p10)>0 then n10=true:if length(p11)>0 then n11=true:if length(p12)>0 then n12=true
  466.         if length(p13)>0 then n13=true:if length(p14)>0 then n14=true:if length(p15)>0 then n15=true
  467.         if length(p16)>0 then n16=true:if length(p17)>0 then n17=true:if length(p18)>0 then n18=true
  468.         goto page2
  469.  
  470. -- Untags all entries.
  471.  
  472. LABEL UNTAG
  473.         n1=false:n2=false:n3=false:n4=false:n5=false:n6=false:n7=false:n8=false:n9=false
  474.         n10=false:n11=false:n12=false:n13=false:n14=false:n15=false:n16=false:n17=false:n18=false
  475.         n19=false
  476.         goto page1
  477.  
  478. -- Verifies profile and goes online, then chains to the Start subroutine below with
  479. -- the actual number and description listed in the profile.  If the "profile"
  480. -- passed is a manually entered number (p19), default communications parameters are used.
  481.  
  482. LABEL TEST
  483.         recycleseconds=15
  484.         if num=p19 then {
  485.                 new
  486.                 number=p19
  487.                 ddesc=number+" (manual entry)"
  488.                 goto init
  489.                 }
  490.         if inbook(num) then load num else topic="Error":mess="Cannot find "+num+".":gosub common1:goto page1
  491.         if look=false then display=off else display=on
  492.         ddesc=description
  493.         message "Dialing "+ddesc
  494.         trap on
  495.         go
  496.         watch 5 seconds for
  497.                 "OK":wait 1 second:goto start
  498.         endwatch:topic="Error":mess="Probable modem problem.":gosub common1:goto page1
  499.         
  500. -- This subroutine simply copies the last-called date to a new variable, before
  501. -- "stamping" the current date to the selected number; if no connection is made
  502. -- the original last-called date variable remains intact.
  503.  
  504. LABEL STAMP
  505.         t1=y1:t2=y2:t3=y3:t4=y4:t5=y5:t6=y6:t7=y7:t8=y8:t9=y9:t10=y10:t11=y11:t12=y12:t13=y13:t14=y14:t15=y15:t16=y16:t17=y17:t18=y18:return
  506.  
  507. -- The recycling subroutine itself, which sends the active profile name to
  508. -- the Test subroutine above.  The counter is arbitrarily set to 99 retries.
  509.  
  510. LABEL QUEUE
  511.         if icon=true then minimize
  512.         while not online or not connected {
  513.                 repeat
  514.                         x=x+1
  515.                         if n1=true then num=p1:gosub stamp:t1=w:gosub test
  516.                         if n2=true then num=p2:gosub stamp:t2=w:gosub test
  517.                         if n3=true then num=p3:gosub stamp:t3=w:gosub test
  518.                         if n4=true then num=p4:gosub stamp:t4=w:gosub test
  519.                         if n5=true then num=p5:gosub stamp:t5=w:gosub test
  520.                         if n6=true then num=p6:gosub stamp:t6=w:gosub test
  521.                         if n7=true then num=p7:gosub stamp:t7=w:gosub test
  522.                         if n8=true then num=p8:gosub stamp:t8=w:gosub test
  523.                         if n9=true then num=p9:gosub stamp:t9=w:gosub test
  524.                         if n10=true then num=p10:gosub stamp:t10=w:gosub test
  525.                         if n11=true then num=p11:gosub stamp:t11=w:gosub test
  526.                         if n12=true then num=p12:gosub stamp:t12=w:gosub test
  527.                         if n13=true then num=p13:gosub stamp:t13=w:gosub test
  528.                         if n14=true then num=p14:gosub stamp:t14=w:gosub test
  529.                         if n15=true then num=p15:gosub stamp:t15=w:gosub test
  530.                         if n16=true then num=p16:gosub stamp:t16=w:gosub test
  531.                         if n17=true then num=p17:gosub stamp:t17=w:gosub test
  532.                         if n18=true then num=p18:gosub stamp:t18=w:gosub test
  533.                         if n19=true then num=p19:gosub stamp:gosub test
  534.                 until x=99
  535.                 alarm:alarm:alarm:show
  536.                 topic="Alert":mess="No connections were made.":gosub common1:cls:new:goto page1
  537.                 }
  538.         wend
  539.  
  540. -- The actual direct-address modem dialing routine and results watch.  The direct-
  541. -- address approach must be used when multiple numbers have been selected to inhibit
  542. -- the foreground appearance of CrossTalk's "Dialing - " message box when CrossTalk
  543. -- is running as a background task; otherwise relative transparency in background
  544. -- cycling through profiles would not be possible.
  545. -- Thanks to S. Jenkins for sharing his superior number parsing routine with me.
  546.  
  547. LABEL START
  548.         reply modeminit
  549.         scrap=upcase(number)
  550.         if instr(scrap,';') then scrap=slice(scrap,1,';')
  551.         if instr(scrap,'X') then scrap=strip(scrap,'X')
  552.         else if instr(scrap,'L') then scrap=ldnumber+strip(scrap,'L')
  553.                 else scrap=outnumber+scrap
  554.         if instr(dialprefix,'AT') then scrap=insert(dialprefix,modifier,instr(dialprefix,'AT')+2)+scrap+dialsuffix
  555.         else scrap=dialprefix+scrap+dialsuffix
  556.         reply scrap;
  557.         watch for
  558.                 "CONNECT":goto bingo
  559.                 "BUSY":message "Busy":return
  560.                 "NO CARRIER":message "No Carrier":return
  561.                 "NO DIAL":topic="Error":mess="No dial tone.":gosub common1:cls:new:goto page1
  562.                 "ERROR":topic="Error":mess="Probable modem problem.":gosub common1:cls:new:goto page1
  563.                 KEY 27:show:message "Dialing queue cancelled, please wait...":bye:n19=false:cls:new:gosub stamp:goto page1
  564.         endwatch
  565.         trap off:bye
  566.                 
  567. -- This routine uses CrossTalk's native "call" or "dial" statements, in the
  568. -- event a manual entry has been selected.  Unlike prior versions of AutoList,
  569. -- single selected numbers must go through the queue routine, to ensure proper
  570. -- updating of the last-called variable, in the event of a connection.
  571.   
  572. LABEL SINGLE
  573.         trap on
  574.         if exists(scrap) then load scrap else new:redialcount=99
  575.         if length(number)>0 then {
  576.                 dial number
  577.                 if connected then alarm:alarm:alarm:show:chain script:end
  578.                 trap off:goto page1
  579.                 }
  580.         else call scrap:end
  581.         
  582. -- This subroutine checks whether one or more selections have been made and
  583. -- then chains to the appropriate subroutine above.
  584.  
  585. LABEL CHECKLIST
  586.         x=0
  587.         if n1=true and length(p1)>0 then x=x+1:scrap=p1:t1=w
  588.         if n2=true and length(p2)>0 then x=x+1:scrap=p2:t2=w
  589.         if n3=true and length(p3)>0 then x=x+1:scrap=p3:t3=w
  590.         if n4=true and length(p4)>0 then x=x+1:scrap=p4:t4=w
  591.         if n5=true and length(p5)>0 then x=x+1:scrap=p5:t5=w
  592.         if n6=true and length(p6)>0 then x=x+1:scrap=p6:t6=w
  593.         if n7=true and length(p7)>0 then x=x+1:scrap=p7:t7=w
  594.         if n8=true and length(p8)>0 then x=x+1:scrap=p8:t8=w
  595.         if n9=true and length(p9)>0 then x=x+1:scrap=p9:t9=w
  596.         if n10=true and length(p10)>0 then x=x+1:scrap=p10:t10=w
  597.         if n11=true and length(p11)>0 then x=x+1:scrap=p11:t12=w
  598.         if n12=true and length(p12)>0 then x=x+1:scrap=p12:t12=w
  599.         if n13=true and length(p13)>0 then x=x+1:scrap=p13:t13=w
  600.         if n14=true and length(p14)>0 then x=x+1:scrap=p14:t14=w
  601.         if n15=true and length(p15)>0 then x=x+1:scrap=p15:t15=w
  602.         if n16=true and length(p16)>0 then x=x+1:scrap=p16:t16=w
  603.         if n17=true and length(p17)>0 then x=x+1:scrap=p17:t17=w
  604.         if n18=true and length(p18)>0 then x=x+1:scrap=p18:t18=w
  605.         if n19=true and length(p19)>0 then x=x+1:scrap=p19
  606.         if x=0 then topic="Alert":mess="No number(s) selected.":gosub common1:goto page1
  607.         if x=1 then {
  608.                 if n19=true then goto single else goto queue
  609.                 }
  610.         if x>1 then goto queue
  611.  
  612.  
  613. -- The create new directory list dialog box.
  614.  
  615. LABEL NEWDIR
  616.         message "Press [ESC] to cancel."
  617.         dialogbox 45,60,232,19
  618.                 ltext 3,5,28,12,"Create "
  619.                 edittext 31,3,39,12,z,dump,focus
  620.                 ltext 73,5,98,12,".FON as a new directory."
  621.                 defpushbutton 194,3,36,14,"Ok",ok,tabstop
  622.         enddialog
  623.         if choice=1 then {
  624.                 if length(dump)=0 then goto options
  625.                 if length(dump)>8 then {
  626.                         topic="Error":mess="Invalid file name.":gosub common1:goto newdir
  627.                         }
  628.         else dump=upcase(dump)+".FON"
  629.         dirname=dump
  630.         current=upcase(dirname)
  631.         dirname=dirxwp+"\"+dirname
  632.         gosub include:goto read_dir
  633.         
  634. -- The global single button message box.
  635.  
  636. LABEL COMMON1
  637.         dialogbox 85,36,155,72
  638.                 groupbox 7,4,94,63,topic
  639.                 ltext 12,20,84,40,mess
  640.                 defpushbutton 111,27,36,17,"&Ok",ok,tabstop,focus
  641.         enddialog
  642.         return
  643.  
  644. -- The global two-button dialog box.
  645.  
  646. LABEL COMMON2
  647.         dialogbox 85,36,155,72
  648.                 groupbox 7,4,94,63,topic
  649.                 ltext 12,20,84,40,mess
  650.                 defpushbutton 111,17,36,17,b1,ok,tabstop,focus
  651.                 pushbutton 111,41,36,17,b2,cancel,tabstop
  652.         enddialog
  653.         return
  654.  
  655. -- Connection made subroutine restores CrossTalk to the foreground and 
  656. -- its original window size if iconized, and terminates the script, after
  657. -- updating the current directory list with new last-called information.
  658.  
  659. LABEL BINGO
  660.         if exists(dirname) then delete dirname
  661.         if not exists(dirname) then {
  662.                 message "Updating directory list, please wait..."
  663.                 dirfile=freefile
  664.                 open output dirname as dirfile
  665.                 close dirfile
  666.                 open append dirname as dirfile
  667.                 write dirfile,p1,d1,t1
  668.                 write dirfile,p2,d2,t2
  669.                 write dirfile,p3,d3,t3
  670.                 write dirfile,p4,d4,t4
  671.                 write dirfile,p5,d5,t5
  672.                 write dirfile,p6,d6,t6
  673.                 write dirfile,p7,d7,t7
  674.                 write dirfile,p8,d8,t8
  675.                 write dirfile,p9,d9,t9
  676.                 write dirfile,p10,d10,t10
  677.                 write dirfile,p11,d11,t11
  678.                 write dirfile,p12,d12,t12
  679.                 write dirfile,p13,d13,t13
  680.                 write dirfile,p14,d14,t14
  681.                 write dirfile,p15,d15,t15
  682.                 write dirfile,p16,d16,t16
  683.                 write dirfile,p17,d17,t17
  684.                 write dirfile,p18,d18,t18
  685.                 close dirfile
  686.                 }
  687.         if icon=true then restore
  688.         message "Connected to "+ddesc
  689.         alarm:alarm:alarm
  690.         chain script:end
  691.  
  692. -- The exit options dialog box.
  693.  
  694. LABEL FINISH
  695.         if connected then bye
  696.         display=on
  697.         cls
  698.         message "AutoList Exit Options"
  699.         dialogbox 85,36,155,72
  700.                 ctext 10,8,133,11,"Close AutoList and exit to:"
  701.                 defpushbutton 10,47,134,18,"&Cancel",cancel,tabstop,focus
  702.                 pushbutton 10,24,63,18,"Cross&Talk",tabstop
  703.                 pushbutton 81,24,63,18,"&Windows",tabstop
  704.         enddialog
  705.         if choice=1 then goto page1
  706.         if choice=2 then new:end
  707.         if choice=3 then terminate
  708.